/*
 *   Copyright 1999-2016 Asiainfo Technologies(China),Inc.
 *
 *   Licensed under the Apache License, Version 2.0 (the "License");
 *   you may not use this file except in compliance with the License.
 *   You may obtain a copy of the License at
 *
 *        http://www.apache.org/licenses/LICENSE-2.0
 *
 *   Unless required by applicable law or agreed to in writing, software
 *   distributed under the License is distributed on an "AS IS" BASIS,
 *   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *   See the License for the specific language governing permissions and
 *   limitations under the License.
 *
 */

package com.asiainfo.redis.config;

//import org.eclipse.jetty.server.Server;
//import org.eclipse.jetty.util.thread.QueuedThreadPool;
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
//import org.springframework.boot.context.embedded.jetty.JettyServerCustomizer;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;

/**
 * @version v 1.0 on 2016/5/25 15:34
 * @auther william.xu
 */
//@Configuration
public class JettyEmbeddedServletContainerConfig {

//    @Bean
//    public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory(
//            @Value("${server.port:8080}") final String port,
//            @Value("${jetty.threadPool.maxThreads:200}") final String maxThreads,
//            @Value("${jetty.threadPool.minThreads:8}") final String minThreads,
//            @Value("${jetty.threadPool.idleTimeout:60000}") final String idleTimeout) {
//        final JettyEmbeddedServletContainerFactory factory =  new JettyEmbeddedServletContainerFactory(Integer.valueOf(port));
//        factory.addServerCustomizers(new JettyServerCustomizer() {
//            @Override
//            public void customize(final Server server) {
//                // Tweak the connection pool used by Jetty to handle incoming HTTP connections
//                final QueuedThreadPool threadPool = server.getBean(QueuedThreadPool.class);
//                threadPool.setMaxThreads(Integer.valueOf(maxThreads));
//                threadPool.setMinThreads(Integer.valueOf(minThreads));
//                threadPool.setIdleTimeout(Integer.valueOf(idleTimeout));
//            }
//        });
//        return factory;
//    }
}
